package test_modele;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import modele.Album;
import modele.ListModelAlbums;
/**
 * 
 * @author Plancq Charlotte, Lanvin Kévin, Darras Raphael
 *
 *
 */
public class TListAlbumModel {
	Album a,b,c;
	ListModelAlbums<Album> listeModele;
	List<Album> liste;
	@Before
	public void setUp(){
		liste=new ArrayList<Album>();
		listeModele= new ListModelAlbums<Album>(this.liste);
		a = new Album("Tintin au Tibet", "Hergé", "editeur", "aventure", "Tintin", "synopsis", 5, " "," ");
		b= new Album("Nitnit au Tebit","Géher",null,"l'Aaaaaventura","Nitnit","resumé", 6, "abcd"," ");
		c=new Album("Tintin au Tibet", "Hergé", "editeur", "aventure", "Tintin", "synopsis", 0, null,null);
		liste.add(a);
		liste.add(b);
		liste.add(c);
	}
	
	@Test
	public void testGetElementAt(){
		assertEquals(a, listeModele.getElementAt(0));
		assertEquals(b, listeModele.getElementAt(1));
		assertEquals(c, listeModele.getElementAt(2));		
	}

	@Test
	public void testGetSize(){
		assertEquals(3, listeModele.getSize());
		liste.remove(a);
		assertEquals(2, listeModele.getSize());
	}


}
